<?php


namespace app\api\controller;

use app\api\service\QrCode;

//http://cosmo.com/api/Qr/getQrCode
class Qr extends BaseApi
{

    public function getQrCode()
    {
        if (!$this->request->param('openid') || !$this->request->param('type')) {
            return json(['code' => -1, 'msg' => '缺少参数']);
        }

        $openid = trim($this->request->param('openid'));
        $type = intval($this->request->param('type'));

        $qr = new QrCode();
        $result = $qr->getQrCodes($openid,$type);

        return json(['code' => 1, 'data' => $result]);
    }


}